/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("WaitUpgradeDev",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.RadarDevice.IServices;
using Microsoft.AspNetCore.Authorization;
using VOL.Entity.DomainModels.Devices.Dto;
using VOL.Entity.DomainModels.UpgradeManager.Dto;

namespace VOL.RadarDevice.Controllers
{
    public partial class WaitUpgradeDevController
    {
        private readonly IWaitUpgradeDevService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public WaitUpgradeDevController(
            IWaitUpgradeDevService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }
        /// <summary>
        /// 插入请求升级记录
        /// </summary>
        /// <param name="RequestUpgradeDto">插入参数</param>
        /// <returns></returns>
        [HttpPost, Route("requestUpgrade")]
        public async Task<IActionResult> RequestUpgrade([FromBody] RequestUpgradeDto dto)
        {
            return Json(await Service.RequestUpgrade(dto));
        }
    }
}
